//
// Created by dq550457 on 19-1-9.
//

#ifndef WIFIDEMO_TRANSATE_H
#define WIFIDEMO_TRANSATE_H


#include <jni.h>
#include <memory>

typedef struct _session_ {
    uint8_t len[10];
    uint8_t data[10][64];
} tSession;

class transate {
private:
    constexpr static char leadCode[4] ={0x3c,0x3d,0x3e,0x3f};
    const static uint8_t PACK_SIZE_MAX = 64;
    tSession sessions[255]={};
protected:
    virtual void sendCommand(JNIEnv *env, jobject instance,const char * msg,int what);

public:
    uint32_t popCommand(uint16_t sessionID, uint8_t * out);
    virtual void packCommand(JNIEnv *env, jobject instance,const char * msg,uint32_t len,int what);
    virtual bool unpackCommand(const char * msg,uint32_t len,uint16_t * sessionID);
};

#endif //WIFIDEMO_TRANSATE_H
